<!DOCTYPE HTML>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="format-detection" content="telephone=no">
		<meta name="description" content="">
		<meta http-equiv="x-dns-prefetch-control" content="on">
		<title>搭车列表</title>
		<link href="../imgv2/css/css.css" rel="stylesheet" type="text/css">
	</head>

	<body class="whitebg">
		<!--wrap start-->
		<section id="wrap">
			<section class="tabarea">
				<ul class="tabbg">
					<li class="tabbtn tabbtn_active" listtype="4" ordertype="6"><a href="javascript:void(0);">我创建的</a>
					</li>
					<li class="tabbtn" listtype="4" ordertype="7"><a href="javascript:void(0);">被邀请的</a>
					</li>
				</ul>
			</section>
			<section id="contain" class="citylist whitebg">
				<!--  <a href="#">
          <img src="../imgv2/user_pic.png" width="100%" height="100%" class="tripuser"/>
          <ul class="listitem h120 bottomline">
              <li class="triptitle mt10">发送给 好友 的请求</li>
              <li class="tripinfo">
                  <p class="peoplenumber"></p>
                  <p class="status_green w160">等待好友接受</p>
              </li>
          </ul>
          </a>
          <a href="#">
          <img src="../imgv2/user_pic.png" width="100%" height="100%" class="tripuser"/>
          <ul class="listitem h120 bottomline">
              <div class="triptitle mt10">发送给Gavin的请求</div>
              <div class="tripinfo">
                  <p class="peoplenumber"></p>
                  <p class="status_green w160">好友已接受</p>
              </div>
          </ul>
          </a>
          <a href="#">
          <img src="../imgv2/user_pic.png" width="100%" height="100%" class="tripuser"/>
          <ul class="listitem h120 bottomline">
              <div class="triptitle mt10">发送给Jim的请求</div>
              <div class="tripinfo">
                  <p class="peoplenumber"></p>
                  <p class="status_gray w160">好友已拒绝</p>
              </div>
          </ul>
          </a>
          <a href="#">
          <img src="../imgv2/user_pic.png" width="100%" height="100%" class="tripuser"/>
          <ul class="listitem h120 bottomline">
              <div class="triptitle mt10">发送给Jim的请求</div>
              <div class="tripinfo">
                  <p class="peoplenumber"></p>
                  <p class="status_gray w160">搭车已结束</p>
              </div>
          </ul>
          </a> -->
			</section>
		</section>
	</body>
	<script src="../jsv2/jQuery/jquery-1.11.2.min.js"></script>
	<script src="../jsv2/common.js"></script>
	<script src="../jsv2/lib/json3.min.js"></script>
	<script src="../jsv2/lib/k-utils-fn.js"></script>
	<script src="../jsv2/lib/fastclick.js"></script>
	<script src="../jsv2/PageValueValidate.js"></script>
	<script src="../jsv2/lib/QueryStringParser.js"></script>
	<script src="../jsv2/jQuery/jquery.json.min.js"></script>
	<script src="../jsv2/jsonMsg.js"></script>
	<script src="../jsv2/journey/operateData.js"></script>
	<script>
		var latLon = "";
		var openId = queryString.getParam("openid");
		var innerContain = "";
		var currentListType = 1;
		var currentOrderType = 1;

		function addTrip() {
			window.location.href = "create_car.html?openid=" + openId;
		}

		function getItem(url, title, senderImage, receiverImage) {
			var content = "";
			content += '<a href="' + url + '">';
			content += '<div class="list_group">';
			content += '<img src="' + senderImage + '" width="50px;" height="50px;" class="user_pic">';
			content += '<div class="list_text">';
			content += '<div class="list_title_car">' + title + '</div>';
			content += '<div class="list_car_to">';
			content += '<p class="fl mr10"><img src="../imgv2/green_arrow.png"></p>';
			content += '<p class="fl"><img src="' + receiverImage + '" width="50px;" height="50px;"></p>';
			content += '</div>';
			content += '</div>';
			content += '</div>';
			content += '</a>';
			return content;
		}

		function handleOrder(orderType) {
			if (openId == null || openId == "") {
				//return false;	
			} else {
				$('.sort').find('span').removeClass('sortstyle_yellow2');
				if (orderType == 1) {
					$('.sort').find('span:first').addClass('sortstyle_yellow2');
				} else if (orderType == 2) {
					$('.sort').children('div').eq(1).find('span').addClass('sortstyle_yellow2');
				}
				currentOrderType = orderType;
				sendRequest(currentListType, currentOrderType);
			}
		}

		function handleTab(listType) {
			if (openId == null || openId == "") {
				return;
			}
			$('.tab3').find('div').removeClass('tabstyle2_d').removeClass('tabstyle2').removeClass('line_left');
			if (listType == 2) {
				$('.tab3').children('div').eq(1).addClass('tabstyle2_d');
				$('.tab3').find('div:first').addClass('tabstyle2').addClass('line_left');
			} else {
				$('.tab3').children('div').eq(1).addClass('tabstyle2').addClass('line_left');
				$('.tab3').find('div:first').addClass('tabstyle2_d');
			}
			currentListType = listType;
			currentOrderType = 1;
			handleOrder(currentOrderType);
		}

		function sendRequest(listType, orderType) {
			var dataStr = {
				ListType: listType,
				OrderType: orderType,
				Cursor: 0,
				Limit: 15,
				Direction: 0
			};
			bidgeToWeixin(openId, 'ListPickup', dataStr, function(data, status, xhr) {
				$("#contain").html('');
				if (data.portalResp.Data.pickups && data.portalResp.Data.pickups.length > 0) {
					var content = "";
					$.each(data.portalResp.Data.pickups, function(index, item) {
						var url = 'car_detail.html?openid=' + openId + '&pickupid=' + item.PickupID;
						var title = item.Title;
						var senderImage = item.SenderPortrait;
						var receiverImage = item.ReceiverPortrait;
						content += getItem(url, title, senderImage, receiverImage);
					});
					$("#contain").html(content);
				}
			});
		}
		$(document).ready(function() {
			if (openId.indexOf("#") > -1) {
				openId = openId.replace("#", "");
			}
			handleOrder(currentListType, currentOrderType);
		});
	</script>

</html>